<include file="public@header"/>
<style type="text/css">
    /*.control-group1{width:90%; margin:10px 5%; overflow:hidden; border-bottom:1px dashed #eee}*/
    /*.control-group label{ width:50%; float:left}*/

    .minwidth {
        width: 45px !important
    }

    /*.control-group1 label{ width:100%; float:left}*/
    /*.form-horizontal .control-group1 {*/
    /*    float: left;*/
    /*    width: 20%;*/
    /*    margin-bottom: 20px;*/
    /*}*/
    .form-horizontal .control-label {
        width: 100px;
    }

    .form-horizontal .form-group {
        margin-left: 0;
        margin-right: 0;
    }

    /*.form-horizontal .controls {margin-left:110px;}*/
    .w95 {
        width: 95px;
    }

    .w100 {
        width: 100px;
    }

    .w110 {
        width: 110px;
    }

    input, select, textarea, .uneditable-input {
        max-width: 200px;
        width: auto;
    }

    .other_charge {
        display: none;
    }

    .col-lg-2 {
        padding: 0 0 0 13px;
    }
    .checkbox-custom {
        position: relative;
        padding: 0 15px 0 25px;
        margin-bottom: 7px;
        margin-top: 0;
        display: inline-block;
    }
    .checkbox-custom {
        position: relative;
        padding: 0 15px 0 25px;
        margin-bottom: 7px;
        margin-top: 0;
        display: inline-block;
    }
    /*
    将初始的checkbox的样式改变
    */
    .checkbox-custom input[type="checkbox"] {
        opacity: 0;/*将初始的checkbox隐藏起来*/
        position: absolute;
        cursor: pointer;
        z-index: 2;
        margin: -6px 0 0 0;
        top: 50%;
        left: 3px;
    }
    /*
    设计新的checkbox，位置
    */
    .checkbox-custom label:before {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        margin-top: -9px;
        width: 19px;
        height: 18px;
        display: inline-block;
        border-radius: 2px;
        border: 1px solid #bbb;
        background: #fff;
    }
    /*
    点击初始的checkbox，将新的checkbox关联起来
    */
    .checkbox-custom input[type="checkbox"]:checked +label:after {
        position: absolute;
        display: inline-block;
        font-family: 'Glyphicons Halflings';
        content: "\e013";
        top: 42%;
        left: 3px;
        margin-top: -5px;
        font-size: 11px;
        line-height: 1;
        width: 16px;
        height: 16px;
        color: #333;
    }
    .checkbox-custom label {
        cursor: pointer;
        line-height: 1.2;
        font-weight: normal;/*改变了rememberme的字体*/
        margin-bottom: 0;
        text-align: left;
    }
</style>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('orders/visua')}">{:lang('可视化墓区')}</a></li>
        <li class="active"><a href="">墓位信息</a></li>
    </ul>
    <form class="form-horizontal ajax-form" method="post" data-action="{:url('Orders/sale')}"
          enctype="multipart/form-data" style="width:80%;float:left;">
        <fieldset>
            <div class="p_title">
                <span class="span_title">墓位详情</span>
            </div>

            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="form-group">
                    <label class=" control-label">左右长度</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" disabled style="width: 120px"
                               value="{$result.tombstone_h|default=''}">mm
                    </div>
                    <label class="control-label">纵深宽度</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="" style="width: 120px"  disabled
                               value="{$result.tombstone_w|default=''}">mm
                    </div>
                    <label class="control-label">占地面积</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="" style="width: 120px" disabled value="{$result.footprint|default=''}">
                        <input type="checkbox" disabled name=" " value="1"
                        <if condition="'1' eq $result['is_bye']">checked</if>
                        >含拜道
                    </div>
                    <label class="control-label">设计墓穴</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control  " name="design" disabled style="width: 120px"
                               value="{$result.design|default='0'}套">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">最高限制高度</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="limit_height" disabled style="width: 120px"
                               value="{$result.limit_height|default='0'}">
                    </div>
                    <label class="control-label">外围设置</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="periphery" disabled
                               value="{$result.periphery|default=''}">
                    </div>
                    <label class="control-label">石材保质期</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" disabled value="购买起计3年">

                    </div>
                    <label class="control-label">墓穴维护期</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control"  disabled   value="首位安葬起20年">
                    </div>
                </div>
                <div class="form-group">
                    <div class="control-group1">
                        <label class="control-label">抵顶人</label>
                        <div class="col-lg-2">
                            <input type="text" class="form-control" name="reaching"   style="width: 150px"value="{$result.reacher|default=''}" disabled >
                        </div>
                    </div>
                    <label class="control-label">类型</label>
                    <div class="col-lg-2">
                        <input type="hidden" name="tomb_type" value="{$cate_id}">
                        <input type="text" class="form-control" name="" disabled value="{$cate_name}" style="width: 120px" >
                    </div>
                </div>
            </div>
            <div class="p_title">
                <span class="span_title">订单详情</span>
                <input type="hidden" name="order[order_id]" value="{$result.order_id|default=''}">
                <input type="hidden" name="order[tomb_product_id]" value="{$result.id}">
                <input type="hidden" name="order[tomb_type]" value="{$cate_id}">
                <input type="hidden" name="order[tomb_id]" value="{$result.colID|default=''}">
                <input type="hidden" name="order[tomb_num]" value="{$result.num|default=''}">
                <input type="hidden" name="order[orders_id]" value="{$orders_id|default=''}">
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="form-group">
                    <label class="control-label">墓位编号</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" disabled value="{$result.num|default=''}">
                    </div>

                    <label class="control-label">所在区域</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="tomb_region" value="{$result.tomb_region|default=''}" disabled>
                    </div>
                    <label class="control-label">具体位置</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="tomb_address" value="{$result.tomb_address|default=''}" disabled>
                    </div>
                    <label class="control-label">墓位状态</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control" name="tomb_status" value="{$result.tomb_status|default=''}" disabled>
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">下单时间</label>
                    <div class="col-lg-2">
                        <input type="hidden"   name="add_time" value="{$result.add_order_time}" >
                        <input type="text" class="form-control js-date" name="add_time" value="{$result.add_order_time}" disabled>
                    </div>
                    <label class="control-label">导购员</label>
                    <div class="col-lg-2">
                        <input type="hidden"   name="order[shoppingguide]" value="{$result.shoppingguide}" >
                        <input type="text" class="form-control" disabled value="{$result.shoppingguide_name}">
                    </div>
                    <label class="control-label">备注</label>
                    <div class="col-lg-2">
                        <textarea type="text" class="form-control" rows="2" cols="65" disabled style="width:600px;" name="remark" placeholder="输入墓位信息备注" >{$result.remark|default=''}</textarea>
                    </div>
                </div>
            </div>
            <div class="p_title">
                <span class="span_title">认购详情</span>
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="form-group">
                    <label class="control-label">销售单价</label>
                    <div class="col-lg-2">
                        <input type="hidden" class="selling_price"  name="order[selling_price]"  value="{$result.selling_price|default=''}">
                        <input type="text" class="form-control selling_price"  disabled value="{$result.selling_price|default=''}元/平方">
                    </div>
                    <label class="control-label">认购面积</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control subscription_area" style="width: 100px;" id="subscription_area" name="order[subscription_area]"
                               value="{$result.subscription_area|default='1'}">平方
                    </div>
                    <label class="control-label">销售合计</label>
                    <div class="col-lg-2">
                        <input type="hidden" class="sales_total"  name="order[sales_total]" disabled value="{$result.sales_total|default=''}">
                        <input type="text" class="form-control sales_total"   disabled value="{$result.sales_total|default=''}">元
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label">优惠减免</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control discount_ratio" id="discount_ratio"  style="width: 80px;"  >%
                        <input type="hidden" class="form-control "  id="discount_ratio_"  name="order[discount_ratio]" value="{$result.discount_ratio|default='0'}">
                        <br><span style="color: #df0505; font-size: 2px">例：95折，输入5。 </span>
                    </div>
                    <label class="control-label">总价合计</label>
                    <div class="col-lg-2">
                        <input type="text" class="form-control total_price"  name="order[total_price]" value="{$result.total_price|default='0'}">元
                    </div>
                    <label class="control-label"style="">免零金额</label>
                    <div class="col-md-2" style=" ">
                        <input type="text" name="order[free_price]" style="width: 100px;" class="form-control free_price" value="{$result.free_price|default='0'}" <if condition="$result.reacher">disabled <else/>    </if> >元
                    </div>
                    <label class="control-label">成交价</label>
                    <div class="col-lg-2">
                        <input type="hidden" class=" closing_price" name="order[closing_price]" value="{$result.closing_price|default='0'}">
                        <input type="text" class="form-control closing_price" name="order[closing_price]" value="{$result.closing_price|default='0'}"disabled> 元
                    </div>

                </div>

                <div class="form-group">
                    <label class="control-label">总价包含</label>
                    <div class="col-lg-2" style="width: 10%">
                        <select name="order[total_price_includes]" class="form-control" style="width: 100%">
                            <if condition=" isset($result['stages_num'])">
                                <option value="1"   <if condition="1 eq $result['total_price_includes']">selected</if>>净地价</option>
                                <option value="2"   <if condition="2 eq $result['total_price_includes']">selected</if>>墓碑一套</option>
                                <option value="3"   <if condition="3 eq $result['total_price_includes']">selected</if>>墓碑二套</option>
                                <option value="4"   <if condition="4 eq $result['total_price_includes']">selected</if>>墓碑三套</option>
                                <option value="5"   <if condition="5 eq $result['total_price_includes']">selected</if>>墓碑四套</option>
                                <option value="6"   <if condition="6 eq $result['total_price_includes']">selected</if>>墓碑五套</option>
                                <else/>
                                <option value="1">净地价</option>
                                <option value="2">墓碑一套</option>
                                <option value="3">墓碑二套</option>
                                <option value="4">墓碑三套</option>
                                <option value="5">墓碑四套</option>
                                <option value="6">墓碑五套</option>
                            </if>
                        </select>
                    </div>
                    <label class="control-label" style="width: 10px"></label>
                    <div class="col-lg-2" style="width: 10%;">
                        <input type="hidden" class="process_cost" id="process_cost" name="order[process_cost]" value="{$result.process_cost|default='0'}">
                        <input type="hidden" class="pay_service" id="pay_service" name="order[pay_service]" value="{$result.pay_service|default='0'}">
                        <input type="hidden" class="pay_service_price" id="pay_service_price" name="order[pay_service_price]"value="{$result.pay_service_price|default='0'}">
                        <a class="btn btn-primary" href="javascript:;" id="open_iframe_dialog" title="">另计收费项目</a>
                    </div>
                    <label class="control-label" style="width: 80px">付款分期</label>
                    <div class="col-md-2" style="width: 10%">
                        <select  name="order[stages_num]"   class="form-control discount_ratio">
                            <if condition=" isset($result['stages_num'])">
                                <option value="1" <if condition=" $result['stages_num'] eq 1"> selected </if>>一次性</option>
                                <option value="2" <if condition=" $result['stages_num'] eq 2"> selected </if>>两期</option>
                                <else/>
                                <option value="1">一次性</option>
                                <option value="2">两期</option>
                            </if>
                        </select>
                    </div>
                    <label class="control-label" style="width: 60px;">代理商</label>
                    <div class="col-lg-2" style="width: 10%">
                        <select name="order[agent_user]"   class="form-control" style="width: 160px;">
                            <option value="0">请选择</option>
                            <foreach name="dailishang_list" item="vou">
                                <if condition=" isset($result['agent_user'])">
                                    <option value="{$vou.id}" <if condition=" $result['agent_user'] eq $vou.id"> selected </if>>{$vou.department_name}-{$vou.user_nickname}</option>
                                <else/>
                                    <option value="{$vou.id}">{$vou.department_name}-{$vou.user_nickname}</option>
                                </if>
                            </foreach>
                        </select>
                    </div>
                    <label class="control-label" style="width: 110px;">抵顶人</label>
                    <div class="col-lg-2" style="width: 10%"  >
                        <input type="text" class="form-control" name="reaching"   style="width: 90%"  value="{$result.reacher|default=''}" disabled >
                    </div>
                    <label class="control-label" style="width: 80px;" >经办人</label>
                    <div class="col-lg-2"  >
                        <input type="hidden"   name="order[handle]" value="{$result.handle|default=''}" >
                        <input type="text" style="width: 100px" class="form-control" name="handle" value="{$result.handle_name|default=''}" disabled>
                    </div>
                </div>
            </div>
            <div class="p_title">
                <span class="span_title">方案详情</span>
            </div>
            <div class="control-group1-p" style="border:1px solid #e2e2e2; padding-top:20px;">
                <div class="control-group1" style="width:100%;">
                    <label class="control-label">方案预览</label>
                    <div class="controls">
                        <php>$img_urls=cmf_get_image_preview_url(isset($result['tom_img'])?$result['tom_img']:'');</php>
                        <img src="{$img_urls}" id="thumb-preview" onclick="parent.imagePreviewDialog(this.src);"  width="36" style="cursor: hand"/>
                    </div>
                </div>
                <foreach name="result.baseData" item="vo">
                    <div class="form-group">
                        <div class="col-lg-10">
                            <label class="control-label" style="width:150px;">【{$vo.mb_name|default=''}】</label>
                            <label class="control-label">位置 &nbsp;&nbsp;</label>
                            <input type="text" class="form-control"   value="{$vo.address}" disabled>
                            <input type="hidden"   name="tm_mb_id[]"  value="{$vo.id}"  >
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-2">
                        </div>
                    </div>

                </foreach>
                <div class="form-group">
                    <empty name="result.product_info">
                        <else />
                        <label class="control-label">其他资料</label>
                        <div class="col-lg-2">
                        </div>
                    </empty>

                </div>
                <div id="oth" style="display:  ">
                    <foreach name='result.product_info' item='vo'  key="num">
                    <div class="form-group">
                        <label class=" control-label" style="width: 10%;">{$vo.iname}:</label>
                        <div class="col-lg-2" style="width: 20%">
                            <input type="text" class="form-control" style="width: 28%;" placeholder="宽" value="{$vo.iwidth}" disabled="">
                            <input type="text" class="form-control" style="width: 28%;" placeholder="高" value="{$vo.iheight}" disabled="">
                            <input type="text" class="form-control" style="width: 28%;" placeholder="厚" value="{$vo.ithick}" disabled=""> mm
                        </div>
                        <label class="control-label">石材种类:</label>
                        <div class="col-lg-1">
                            <select class="form-control  icate " name="other[{$num}][icate]">
                                <volist name="cate_type" id="voc">
                                    <if condition="$vo.icate eq $voc.id">
                                        <option value="{$voc.id}" selected>{$voc.name}</option>
                                        <else/>
                                        <option value="{$voc.id}">{$voc.name}</option>
                                    </if>
                                </volist>
                            </select>
                        </div>
                        <label class="control-label">数量:</label>
                            <div class="col-lg-1">
                                <input type="text" class="form-control" style="width:100px;" value="{$vo.inumber}" disabled="">
                            </div>
                            <label class="control-label">维修价格:</label>
                        <div class="col-lg-1">
                            <input type="text" class="form-control" style="width:100px;" value="{$vo.irepair_price}" disabled=""></div>
                        <label class="control-label">更换价格:</label>
                        <div class="col-lg-1">
                            <input type="text" class="form-control" style="width:100px;" value="{$vo.ichange_price}" disabled="">
                        </div>
                        <input type="hidden"   name="tm_mb_id[]"   value="{$vo.tm_mb_id}"  >
                    </div>
                    </foreach>
                </div>
            </div>
        </fieldset>
        <div class="form-actions" style="clear:both;">
            <button type="submit" class="btn btn-primary ajax-submit">下一步</button>
        </div>
    </form>
        <div style="width:20%; float:left">
            <php>$img_cer=cmf_get_image_preview_url(isset($result['tom_img'])?$result['tom_img']:'');$img_cer=$img_cer?$img_cer:'__TMPL__/public/assets/images/1.png'</php>
            <img src="{$img_cer}" class="preview" height="16" style="max-width:200px; display:block; margin:0 auto;"/>
        </div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
</body>
</html>
<script>
    $(function () {
        var selling_price =  $('.selling_price'),// 销售金额
            subscription_area = $('.subscription_area'),// 面积
            sales_total = $('.sales_total'),// 销售合计
            total_price = $('.total_price'),// 总价合计
            free_price = $('.free_price').val(),
            closing_price = $('.closing_price'),// 成交价
            pay_service_price = $('#pay_service_price');// 另计收费项目

        $('.sales_total').val( parseFloat(selling_price.val()*subscription_area.val()).toFixed(2) );//销售合计

        if ($('#discount_ratio_').val()==0){
            $('.total_price').val( parseFloat(sales_total.val()-free_price).toFixed(2) );//总价合计
        }else {
            var discount_ratio_= ($('#discount_ratio_').val())*100;
            $('#discount_ratio').val(100-discount_ratio_);
            var discount_ratio = discount_ratio_/100;//优惠金额
            $('#discount_ratio_').val(discount_ratio);//优惠金额
            console.log('total_price--'+sales_total.val()*discount_ratio)
            $('.total_price').val( parseFloat(sales_total.val()*discount_ratio).toFixed(2) );//总价合计
        }

        var closing_price_log = Number((Number(total_price.val().replace(/,/g, "")).toFixed(2)*1-
            Number(free_price.replace(/,/g,"")).toFixed(2)*1)+
            Number(pay_service_price.val().replace(/,/g,"")).toFixed(2)*1);

        console.log('total_price--'+ total_price.val() )
        closing_price.val(closing_price_log.toFixed(2))//成交价
    })
    $('.subscription_area,.discount_ratio,.free_price').blur(function () {
        var selling_price =  $('.selling_price'),// 销售金额
            subscription_area = $('.subscription_area'),// 面积
            sales_total = $('.sales_total'),// 销售合计
            total_price = $('.total_price'),// 总价合计
            free_price = $('.free_price'),// 总价合计
            closing_price = $('.closing_price'),// 成交价
            pay_service_price = $('#pay_service_price');// 另计收费项目

        $('.sales_total').val( parseFloat(selling_price.val()*subscription_area.val()).toFixed(2) );//销售合计
        var discount_ratio = (100-$('#discount_ratio').val())/100;//优惠金额
        if (discount_ratio<0.8){
            layer.msg('优惠比例不能超过20%');
        } else {
            $('#discount_ratio_').val(discount_ratio);//优惠金额
            $('.total_price').val( parseFloat(sales_total.val()*(discount_ratio)).toFixed(2) );//总价合计
            var closing_price_log = Number((Number(total_price.val().replace(/,/g, "")).toFixed(2)*1-
                Number(free_price.val().replace(/,/g,"")).toFixed(2)*1)+
                Number(pay_service_price.val().replace(/,/g,"")).toFixed(2)*1);
            closing_price.val(closing_price_log.toFixed(2))//成交价
        }

    })

    $("#open_iframe_dialog").click(function () {
        var pay_service_price =$('#pay_service_price'),
            closing_price = $('.closing_price'),// 成交价
            free_price = $('.free_price'),// 减免金额
            total_price = $('.total_price');// 总价合计
        layer.open({
            type: 1,     //包括但不限于一个值 ，具体 可以去查看  2  就是URL
            title: '添加墓碑详情',
            // skin: 'layui-layer-nobg',
            anim: -1,
            shade: [0.001, '#000000'],
            move: false,
            maxmin: false,
            btn:['确认'],
            shadeClose: true,       //我觉着应该再加个onclick shade 遮罩层  Close  关闭
            // shade: 0.6,             //遮罩层 透明度
            area: ['700px', '500px'],   //大小
            content: '<div class="   " style="padding: 20px;">\n' +
                '\t\t<form class="form-horizontal" id="roleForm">\n' +
                '\t\t\t<fieldset>\n' +
                '                <div class="form-group" >\n' +
                '                    <label class="control-label">墓碑加工费</label>\n' +
                '                    <div class="col-lg-2">\n' +
                '                        <select class="form-control" id="process" name="process">\n' +
                '                            <option value="墓碑一套">墓碑一套</option>\n' +
                '                            <option value="墓碑两套">墓碑两套</option>\n' +
                '                            <option value="墓碑三套">墓碑三套</option>\n' +
                '                            <option value="墓碑四套">墓碑四套</option>\n' +
                '                            <option value="墓碑五套">墓碑五套</option>\n' +
                '                        </select>\n' +
                '                    </div>\n' +
                '                </div>\n' +
                '                <div class="form-group">' +
                '<div class="col-sm-12 ">' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="辅材费"><label  for="F_IsMenu">辅材费</label>' +
                '    </div>\n' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="附件费"><label  for="F_IsMenu">附件费</label>' +
                '    </div>\n' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="安装费"><label  for="F_IsMenu">安装费</label>' +
                '    </div>\n' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="绿化费"><label  for="F_IsMenu">绿化费</label>' +
                '    </div>\n' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="维护费"><label  for="F_IsMenu">维护费</label>' +
                '    </div>\n' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="特殊工艺费"><label  for="F_IsMenu">特殊工艺费</label>' +
                '    </div>\n' +
                '   <div class="checkbox-custom checkbox-default">\n' +
                '        <input  name="F_IsMenu" type="checkbox" value="其他费用"><label  for="F_IsMenu">其他费用</label>' +
                '    </div>\n' +
                '                 <div class="form-group"  >\n' +
                '                    <label class="control-label">另计收费合计</label>\n' +
                '                    <div class="col-lg-8">\n' +
                '                        <input type="text" class="form-control" id="total_additional" name="total_additional" value="'+pay_service_price.val()+'" >\n' +
                '                    </div>\n' +
                '                </div>\n' +
                '\t\t\t</fieldset> \n' +
                '\t\t</form>\n' +
                '\t</div>',            //这个和type  有关系，比如type = 1   content='这里可以直接写'
            success:function(){
                console.log(78);
            },
            yes: function(index, layero){
                var roleForm =layero.find('#roleForm input:checkbox:checked'),
                    vals = [],
                    process = layero.find('#process').val(),
                    pay_service_price = parseFloat(layero.find('#total_additional').val()).toFixed(2);// 总价合计
                var closing_price = Number(
                    (Number(total_price.val().replace(/,/g, "")).toFixed(2)*1 -
                    Number(free_price.val().replace(/,/g, "")).toFixed(2)*1) +
                    Number(pay_service_price.replace(/,/g,"")).toFixed(2)*1);

                console.log(closing_price.toFixed(2))
                $('.closing_price').val(closing_price.toFixed(2));
                $('#pay_service_price').val(pay_service_price)
                roleForm.each(function (index, item) {
                    vals.push($(this).val());
                });
                $('#open_iframe_dialog').attr('title',process+','+vals+'。金额为：'+closing_price)
                $('#process_cost').val(process)
                $('#pay_service').val(vals)
                layer.close(index);
            }
        });
    })

    $("#charge_btn").click(function(){
        if($(".other_charge").is(":hidden")){
            $(".other_charge").css("display","block");
        }else{
            $(".other_charge").css("display","none");
        }
    })

    $('#new_pro').click(function () {
        var id = $(this).attr('data-new_pro')
        if ($("#oth").is(":hidden")) {
            var icate = $(this).attr('data-icate');
            $('#icate').append(getOptionHtml(icate));
            $("#oth").css("display", "block");
        } else {
            $("#oth").css("display", "none");
        }
        getOptionHtml(n.icate);
    })

    $(document).ready(function () {
        var cate_type = {$cate_type};
        getOptionHtml = function (icate) {
            var html = "";
            console.log(cate_type)
            $.each(cate_type, function (i, n) {
                if (n.id == icate) {
                    html += "<option value='" + n.id + "' selected>" + n.name + "</option>";
                } else {
                    html += "<option value='" + n.id + "'>" + n.name + "</option>";
                }
            })
            return html;
        }
        var json = {$annexJson};
    })


</script>